package org.example.leetcode.core.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.example.leetcode.common.pojo.PageResult;
import org.example.leetcode.core.domain.TQuestion;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.example.leetcode.core.dto.QuestionPageCond;
import org.example.leetcode.core.dto.QuestionPageVO;
import org.example.leetcode.core.dto.TypeCount;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhc
 * @since 2024-02-25
 */
@Mapper

public interface TQuestionMapper extends BaseMapper<TQuestion> {

    List<TQuestion> selectAll();
    int insertT(@Param("question")TQuestion tQuestion);

    int selectCountByName(@Param("name") String name);

    Page<QuestionPageVO> page(Page<QuestionPageVO> page, @Param("cond") QuestionPageCond questionPageCond);

    /**
     * 先根据自身的做题情况，对历史排序，没做过的排前面。再根据热门程度
     * @param phone
     * @param difficulty
     * @return
     */
    List<QuestionPageVO> hotPage( @Param("currentUser")String phone,@Param("difficulty")String difficulty);


    List<QuestionPageVO> queryByLikelyUser(@Param("users") List<Object> users,@Param("currentUser") String currentUser);

    List<TypeCount> queryLogForTypeCount(@Param("phone") String phone);

    Long queryLogCount(@Param("phone") String phone,@Param("difficulty") String difficulty,@Param("byStatus")String byStatus);

    List<QuestionPageVO> hotPageWithoutLogin();
}
